//
//  CHTabBarController.swift
//  Checked
//
//  Created by admin on 06/03/2017.
//  Copyright © 2017 shinolr_go. All rights reserved.
//

import UIKit

protocol TabBarControllerProtocol {
    func addChildTabController(tabController: UIViewController, imgName: String, title: String)
}

class CHTabBarController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()

        addChildTabController(tabController: CHHomeViewController(), imgName: "", title: "Shows")
        addChildTabController(tabController: CHMineViewController(), imgName: "", title: "Mine")
        navigationItem.title = "Shows"
    }
    
    override func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) {
        navigationItem.title = item.title
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
}

extension CHTabBarController: TabBarControllerProtocol {
    func addChildTabController(tabController: UIViewController, imgName: String, title: String) {
        tabController.title = title
//        let nav = UINavigationController(rootViewController: tabController)
        addChild(tabController)
    }
}
